/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.serc.pensieve.model;

import org.serc.pensieve.data.AdminDao;
import org.serc.pensieve.uicontroller.UserRole;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author zauk
 */
public class Admin extends UserRole{

    private String userName;
    private String password;
    private String role;

    public Admin(String userName, String password, String role) {
        this.userName = userName;
        this.password = password;
        this.role = role;
    }

    


    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }


     public  ArrayList<String> login(String userName, String password) throws ClassNotFoundException, SQLException, FileNotFoundException, IOException
    {
        AdminDao obj=new AdminDao();

            boolean check=false;
            ArrayList<String> tempReceivedUsers = new ArrayList<String>();
            
            tempReceivedUsers=obj.login(userName,password);
            
            return tempReceivedUsers;
    }
       public  ArrayList<String> loginOne(int loginThisUsre_id) throws ClassNotFoundException, SQLException, FileNotFoundException, IOException
    {
        AdminDao obj=new AdminDao();

            ArrayList<String> tempReceivedUsers = new ArrayList<String>();

            tempReceivedUsers=obj.loginOne(loginThisUsre_id);

            return tempReceivedUsers;
    }
//Functions from views using userRole (play role pattern).

   //1)
       
    public void AddActor()
    {
    }
      
        public ArrayList<String> SelectSRS()
        {
             ArrayList<String> tempReceivedUsers = new ArrayList<String>();

             AdminDao obj=new AdminDao();
           tempReceivedUsers=   obj.SelectSRS();
            return tempReceivedUsers;
        }

    @Override
         public ArrayList<String> SelectCheckList()
        {
             ArrayList<String> tempReceivedUsers = new ArrayList<String>();

             AdminDao obj=new AdminDao();
           tempReceivedUsers=   obj.SelectCheckList();
            return tempReceivedUsers;
        }
    @Override
            public ArrayList<String> SelectInspectors()
        {
             ArrayList<String> tempReceivedUsers = new ArrayList<String>();

             AdminDao obj=new AdminDao();
           tempReceivedUsers=   obj.SelectInspectors();
            return tempReceivedUsers;
        }


    
    @Override
            public ArrayList<String> SelectModerators()
        {
             ArrayList<String> tempReceivedUsers = new ArrayList<String>();

             AdminDao obj=new AdminDao();
           tempReceivedUsers=   obj.SelectModerators();
            return tempReceivedUsers;
        }
    

    @Override
            public int SaveInspectors(String hsrs_id, String hsrs_name, String hcheck_id, String hcheck_name, ArrayList<String> arrSRS, ArrayList<String> arr1SRS)
        {
             AdminDao obj=new AdminDao();
           int check = -1;
        try {
            check = obj.SaveInspectors(hsrs_id, hsrs_name, hcheck_id, hcheck_name, arrSRS, arr1SRS);
        } catch (SQLException ex) {
            Logger.getLogger(Admin.class.getName()).log(Level.SEVERE, null, ex);
        }
            return check;
        }
             
//should remove from here
    @Override
    public  ArrayList<Inspection> GetNewInspectionData(int tempID) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
//should remove from here

    @Override
    public int import_srs() {
        //throw new UnsupportedOperationException("Not yet implemented");
        AdminDao obj=new AdminDao();
        int check = 0;
        try {
            check = obj.import_srs();
        } catch (SQLException ex) {
            Logger.getLogger(Admin.class.getName()).log(Level.SEVERE, null, ex);
        }
        return check;
    }
    
     public int import_checklist() {
        //throw new UnsupportedOperationException("Not yet implemented");
        AdminDao obj=new AdminDao();
        int check = 0;
        try {
            check = obj.import_checklist();
        } catch (SQLException ex) {
            Logger.getLogger(Admin.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        return check;
    }
}
